<!DOCTYPE html>
<html>
  <!-- meta/link... -->
  



<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  <!-- Global site tag (gtag.js) - Google Analytics -->


  <title>Java笔记(五) | YY&#39;s Blog</title>

  <link rel="icon" type="image/jpeg" href="/medias/favicon.jpg">
  <link rel="stylesheet" href="https://at.alicdn.com/t/font_1911880_c1nvbyezg17.css">
  <link href="https://unpkg.com/@fortawesome/fontawesome-free/css/all.min.css" rel="stylesheet">
  <link href="/js/swiper/swiper@5.4.1.min.css" rel="stylesheet">
  
  
  
  
<link rel="stylesheet" href="/css/animate.min.css">

  
<link rel="stylesheet" href="/css/style.css">

  
  
    
<link rel="stylesheet" href="/js/fancybox/jquery.fancybox.min.css">

  
  
    
<link rel="stylesheet" href="/js/shareJs/share.min.css">

  
  <style>
        @media (max-width: 992px) {
            #waifu {
                display: none;
            }
        }
    </style>
    <script src="//cdn.bootcss.com/pace/1.0.2/pace.min.js"></script>
    <link href="//cdn.bootcss.com/pace/1.0.2/themes/pink/pace-theme-flash.css" rel="stylesheet">

    
        <script src="/js/valine/index.js"></script>
    

    <!-- import link -->
    
        
            
        
            
        
    
    <!-- import script -->
    
        
            <script>function blog_time() {window.setTimeout(blog_time,1000);const now = new Date();const copyrightTime = now.getFullYear();			display_copyright_time.innerHTML = " "+copyrightTime;}blog_time();</script>
        
            <script>function blog_live_time() {window.setTimeout(blog_live_time, 1000);const start = new Date('2020-10-01T00:00:00');const now = new Date();const timeDiff = (now.getTime() - start.getTime());					  const msPerMinute = 60 * 1000;					  const msPerHour = 60 * msPerMinute;					  const msPerDay = 24 * msPerHour;					  const passDay = Math.floor(timeDiff / msPerDay);					  const passHour = Math.floor((timeDiff % msPerDay) / 60 / 60 / 1000);					  const passMinute = Math.floor((timeDiff % msPerHour) / 60 / 1000);const passSecond = Math.floor((timeDiff % msPerMinute) / 1000);display_live_time.innerHTML = " " + passDay + " 天 " + passHour + " 小时 " + passMinute + " 分 " + passSecond + " 秒";}blog_live_time();</script>
        
    

    <!-- import daovoice -->
    

        <script>(function (i, s, o, g, r, a, m) {
            i['DaoVoiceObject'] = r;
            i[r] = i[r] ||
              function () {
                (i[r].q = i[r].q || []).push(arguments);
              };
            i[r].l = 1 * new Date();
            a = s.createElement(o);
            m = s.getElementsByTagName(o)[0];
            a.async = 1;
            a.src = g;
            a.charset = 'utf-8';
            m.parentNode.insertBefore(a, m);
          })(window, document, 'script', ('https:' === document.location.protocol ? 'https:' : 'http:') + "//widget.daovoice.io/widget/5a027b89.js", 'daovoice');
          daovoice('init', {
            app_id: "5a027b89",
          });
          daovoice('update');
        </script>
      
    
<meta name="generator" content="Hexo 5.4.0"></head>

  
  <!-- 依赖于jquery和vue -->
  
    
<script src="https://unpkg.com/jquery@3.5.1/dist/jquery.min.js"></script>

  

  
    
<script src="https://unpkg.com/vue@2.6.11/dist/vue.min.js"></script>

  
  
  <body>
    <!-- 预加载动画 -->
    <!-- 页面预加载动画 -->

<div id='loader'>
  <link rel="stylesheet" href="/js/loaded/index.css" >
  <div class="loading-left-bg"></div>
  <div class="loading-right-bg"></div>
  <div class="spinner-box">
    <div class="configure-border-1">
      <div class="configure-core"></div>
    </div>
    <div class="configure-border-2">
      <div class="configure-core"></div>
    </div>
    <div class="loading-word">加载中...</div>
  </div>
</div>

<script>
  var endLoading = function () {
    document.body.style.overflow = 'auto';
    document.getElementById('loader').classList.add("loading");
  }
  window.addEventListener('DOMContentLoaded',endLoading);
  
</script>

    
    <!-- 判断是否为暗黑风格 -->
    <!-- 判断是否为黑夜模式 -->
<script>
  let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');

  if (isDark) {
    $(document.body).addClass('darkModel');
  }
</script>

    <!-- 需要在上面加载的js -->
    <script>
  function loadScript(src, cb) {
    return new Promise(resolve => {
      setTimeout(function () {
        var HEAD = document.getElementsByTagName("head")[0] || document.documentElement;
        var script = document.createElement("script");
        script.setAttribute("type", "text/javascript");
        if (cb) {
          if (JSON.stringify(cb)) {
            for (let p in cb) {
              if (p == "onload") {
                script[p] = () => {
                  cb[p]()
                  resolve()
                }
              } else {
                script[p] = cb[p]
                script.onload = resolve
              }
            }
          } else {
            script.onload = () => {
              cb()
              resolve()
            };
          }
        } else {
          script.onload = resolve
        }
        script.setAttribute("src", src);
        HEAD.appendChild(script);
      });
    });
  }

  //https://github.com/filamentgroup/loadCSS
  var loadCSS = function (href, before, media, attributes) {
    return new Promise(resolve => {
      setTimeout(function () {
        var link = document.createElement('link');
        link.rel = "stylesheet";
        link.href = src;
        link.onload = resolve;
        document.getElementsByTagName("head")[0].appendChild(link);
      });
    });
  };

</script> 

<!-- 轮播图所需要的js -->
<script src="/js/swiper/swiper.min.js"></script>
<script src="/js/swiper/vue-awesome-swiper.js"></script>
<script src="/js/swiper/swiper.animate1.0.3.min.js"></script>

<script type="text/javascript">
  Vue.use(window.VueAwesomeSwiper)
</script>


  <script src="/js/vue-typed-js/index.js"></script>


<!-- 首页的公告滚动插件的js需要重新加载 -->
<script src="/js/vue-seamless-scroll/index.js"></script>

<!-- 打字机效果js -->
<script src="https://unpkg.com/typed.js@2.0.11"></script>


    <div id="safearea">
      <main class="main" id="pjax-container">
        <!-- 头部导航 -->
        
<header class="header   " 
  id="navHeader"
  style="position: fixed;
  left: 0; top: 0; z-index: 10;width: 100%;"
>
  <div class="header-content">
    <div class="bars">
      <div id="appDrawer" class="sidebar-image">
  <div class="drawer-box-icon">
    <i class="fas fa-bars" aria-hidden="true" @click="showDialogDrawer"></i>
  </div>
  
  <transition name="fade">
    <div class="drawer-box_mask" v-cloak style="display: none;" v-show="visible" @click.self="cancelDialogDrawer">
    </div>
  </transition>
  <div class="drawer-box" :class="{'active': visible}">
    <div class="drawer-box-head bg-color">
      <img class="drawer-box-head_logo lazyload placeholder" src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="logo">
      <h3 class="drawer-box-head_title">YY&#39;s Blog</h3>
      <h5 class="drawer-box-head_desc">三十年河东，三十年河西，莫欺少年穷！</h5>
    </div>
    
    <div class="drawer-box-content">
      <ul class="drawer-box-content_menu">
        
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/" class="drawer-menu-item-link">
                  
                    <i class="fa fa-home" aria-hidden="true"></i>
                  
                  <span class="name">首页</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/archives" class="drawer-menu-item-link">
                  
                    <i class="fa fa-archive" aria-hidden="true"></i>
                  
                  <span class="name">归档</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/tags" class="drawer-menu-item-link">
                  
                    <i class="fa fa-tags" aria-hidden="true"></i>
                  
                  <span class="name">标签</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/categories" class="drawer-menu-item-link">
                  
                    <i class="fa fa-bookmark" aria-hidden="true"></i>
                  
                  <span class="name">分类</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/about" class="drawer-menu-item-link">
                  
                    <i class="fa fa-user" aria-hidden="true"></i>
                  
                  <span class="name">关于</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/comments" class="drawer-menu-item-link">
                  
                    <i class="fa fa-comments" aria-hidden="true"></i>
                  
                  <span class="name">留言</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/friends" class="drawer-menu-item-link">
                  
                    <i class="fa fa-book" aria-hidden="true"></i>
                  
                  <span class="name">友情链接</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="/love" class="drawer-menu-item-link">
                  
                    <i class="fa fa-heart" aria-hidden="true"></i>
                  
                  <span class="name">Love</span>
                </a>
              
            </li>
          
            <li class="drawer-box-content_item" style="position: relative;">
              
                <a href="javascript:;" class="drawer-menu-item-link has-children" @click="openOrCloseMenu(8)">
                  <span>
                    
                      <i class="fa fa-link"></i>
                    
                    <span class="name">更多</span>
                  </span>
                  <i class="fas fa-chevron-left arrow " :class="{'icon-rotate': isOpen(8)}" aria-hidden="true"></i>
                </a>
                <ul class="drawer-sub-menu" v-if="isOpen(8)">
                  
                  <li>
                    <a href="/gallery">
                      
                      <i class="fa fa-music" style="margin-top: -20px;"></i>
                      
                      <span>图库</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/me">
                      
                      <i class="fa fa-user" style="margin-top: -20px;"></i>
                      
                      <span>关于我</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/resources">
                      
                      <i class="fa fa-film" style="margin-top: -20px;"></i>
                      
                      <span>资源</span>
                    </a>
                  </li>
                  
                  <li>
                    <a target="_blank" rel="noopener" href="http://baidu.com">
                      
                      <i class="fa fa-wifi" style="margin-top: -20px;"></i>
                      
                      <span>百度</span>
                    </a>
                  </li>
                  
                </ul>
              
            </li>
          
        
        
          <li class="drawer-box-content_item">
            <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux">
              <i class="fas fa-github" aria-hidden="true"></i>
              <span>Github</span>
            </a>
          </li>
        
      </ul>
    </div>
  </div>
</div>

<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appDrawer',
    data: {
      visible: false,
      top: 0,
      openArr: [],
    },
    computed: {
    },
    mounted() {
    },
    methods: {
      isOpen(index) {
        if (this.openArr.includes(index)) {
          return true;
        } else {
          return false;
        }
      },
      openOrCloseMenu(curIndex) {
        const index = this.openArr.indexOf(curIndex);
        if (index !== -1) {
          this.openArr.splice(index, 1);
        } else {
          this.openArr.push(curIndex);
        }
      },
      showDialogDrawer() {
        this.visible = true;
        // 防止页面滚动，只能让弹框滚动
        this.top = $(document).scrollTop()
        body.style.cssText = 'width: 100%; height: 100%;overflow: hidden;';
      },
      cancelDialogDrawer() {
        this.visible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      }
    },
    created() {}
  })
</script>

    </div>
    <div class="blog-title" id="author-avatar">
      
        <div class="avatar">
          <img src="/medias/logo.png" class="lazyload placeholder" data-srcset="/medias/logo.png" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="logo">
        </div>
      
      <a href="/" class="logo">YY&#39;s Blog</a>
    </div>
    <nav class="navbar">
      <ul class="menu">
        
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/" class="menu-item-link" title="首页">
                  
                    <i class="fa fa-home" aria-hidden="true"></i>
                  
                  <span class="name">首页</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/archives" class="menu-item-link" title="归档">
                  
                    <i class="fa fa-archive" aria-hidden="true"></i>
                  
                  <span class="name">归档</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/tags" class="menu-item-link" title="标签">
                  
                    <i class="fa fa-tags" aria-hidden="true"></i>
                  
                  <span class="name">标签</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/categories" class="menu-item-link" title="分类">
                  
                    <i class="fa fa-bookmark" aria-hidden="true"></i>
                  
                  <span class="name">分类</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/about" class="menu-item-link" title="关于">
                  
                    <i class="fa fa-user" aria-hidden="true"></i>
                  
                  <span class="name">关于</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/comments" class="menu-item-link" title="留言">
                  
                    <i class="fa fa-comments" aria-hidden="true"></i>
                  
                  <span class="name">留言</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/friends" class="menu-item-link" title="友情链接">
                  
                    <i class="fa fa-book" aria-hidden="true"></i>
                  
                  <span class="name">友情链接</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="/love" class="menu-item-link" title="Love">
                  
                    <i class="fa fa-heart" aria-hidden="true"></i>
                  
                  <span class="name">Love</span>
                </a>
              
            </li>
          
            <li class="menu-item" style="position: relative;">
              
                <a href="javascript:;" class="menu-item-link" title="更多">
                  
                    <i class="fa fa-link"></i>
                  
                  <span class="name">更多</span>
                  <i class="fas fa-chevron-down arrow" aria-hidden="true"></i>
                </a>
                <ul class="sub-menu">
                  
                  <li>
                    <a href="/gallery">
                      
                      <i class="fa fa-music" style="margin-top: -20px;"></i>
                      
                      <span>图库</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/me">
                      
                      <i class="fa fa-user" style="margin-top: -20px;"></i>
                      
                      <span>关于我</span>
                    </a>
                  </li>
                  
                  <li>
                    <a href="/resources">
                      
                      <i class="fa fa-film" style="margin-top: -20px;"></i>
                      
                      <span>资源</span>
                    </a>
                  </li>
                  
                  <li>
                    <a target="_blank" rel="noopener" href="http://baidu.com">
                      
                      <i class="fa fa-wifi" style="margin-top: -20px;"></i>
                      
                      <span>百度</span>
                    </a>
                  </li>
                  
                </ul>
              
            </li>
          
        
      </ul>
      
      
        <div id="appSearch">
  <div class="search"  @click="showDialog()"><i class="fas fa-search" aria-hidden="true"></i></div>
  <transition name="fade">
    <div class="message-box_wrapper" style="display: none;" v-cloak v-show="dialogVisible" @click.self="cancelDialogVisible()">
      <div class="message-box animated bounceInDown">
        <h2>
          <span>
            <i class="fas fa-search" aria-hidden="true"></i>
            <span class="title">本地搜索</span>
          </span>
          <i class="fas fa-times close" pointer style="float:right;" aria-hidden="true" @click.self="cancelDialogVisible()"></i>
        </h2>
        <form class="site-search-form">
          <input type="text"
            placeholder="请输入关键字"
            id="local-search-input" 
            @click="getSearchFile()"
            class="st-search-input"
            v-model="searchInput"
          />
        </form>
        <div class="result-wrapper">
          <div id="local-search-result" class="local-search-result-cls"></div>
        </div>
      </div>
    </div>
  </transition>
</div>
<script src="/js/local_search.js"></script>
<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appSearch',
    data: {
      dialogVisible: false,
      searchInput: '',
      top: 0,
    },
    computed: {
    },
    mounted() {
      window.addEventListener('pjax:complete', () => {
        this.cancelDialogVisible();
      })
    },
    methods: {
      showDialog() {
        this.dialogVisible = true;
        // 防止页面滚动，只能让弹框滚动
        this.top = $(document).scrollTop()
        body.style.cssText = 'overflow: hidden;';
      },
      getSearchFile() {
        if (!this.searchInput) {
          getSearchFile("/search.xml");
        }
      },
      cancelDialogVisible() {
        this.dialogVisible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      },
    },
    created() {}
  })
</script>
<!-- 解决刷新页面闪烁问题，可以在元素上添加display: none, 或者用vue.extend方法，详情：https://blog.csdn.net/qq_31393401/article/details/81017912 -->
<!-- 下面是搜索基本写法 -->
<!-- <script type="text/javascript" id="local.search.active">
  var inputArea = document.querySelector("#local-search-input");
  inputArea.onclick   = function(){ getSearchFile(); this.onclick = null }
  inputArea.onkeydown = function(){ if(event.keyCode == 13) return false }
</script> -->

      

    </nav>
  </div>
  
    <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux" class="github-corner color-primary" aria-label="View source on GitHub"><svg width="60" height="60" viewBox="0 0 250 250" style="fill:#fff; position: absolute; top: 0; border: 0; right: 0;" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a><style>.github-corner:hover .octo-arm{animation:octocat-wave 560ms ease-in-out}@keyframes octocat-wave{0%,100%{transform:rotate(0)}20%,60%{transform:rotate(-25deg)}40%,80%{transform:rotate(10deg)}}@media (max-width:500px){.github-corner:hover .octo-arm{animation:none}.github-corner .octo-arm{animation:octocat-wave 560ms ease-in-out}}</style>
  
  
    <div id="he-plugin-simple"></div>
    <script>
      WIDGET = {
        CONFIG: {
          "modules": "012",
          "background": 5,
          "tmpColor": "4A4A4A",
          "tmpSize": 16,
          "cityColor": "4A4A4A",
          "citySize": 16,
          "aqiSize": 16,
          "weatherIconSize": 24,
          "alertIconSize": 18,
          "padding": "10px 10px 10px 10px",
          "shadow": "1",
          "language": "auto",
          "borderRadius": 5,
          "fixed": "false",
          "vertical": "middle",
          "horizontal": "center",
          "key": "2784dd3fcb1e4f0f9a9b579bf69641f2"
        }
      }
    </script>
    <script src="https://widget.qweather.net/simple/static/js/he-simple-common.js?v=2.0"></script> 
    
</header>
        <!-- 内容区域 -->
        
 <!-- prismjs 代码高亮 -->
 


<div class="bg-dark-floor" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: -1;"></div>


  <!-- 文章详情页顶部图片和标题 -->




<div class="post-detail-header" id="thumbnail_canvas" style="background-repeat: no-repeat; background-size: cover; 
  background-position: center center;position: relative;background-image:url('/medias/9.jpg')">
  <div class="post-detail-header-mask"></div>
  <canvas id="header_canvas"style="position:absolute;bottom:0;pointer-events:none;"></canvas>
  
  <div class="post-detail-header_info-box">
    <div class="title-box">
      <span class="title">
        Java笔记(五)
      </span>
    </div>
    
    
      
        <span class="post-detail-header_date">
          <i class="fas fa-calendar"></i> 发表于：2020-10-01 |
        </span>
      

      

      
        <div class="post-detail-header_wordcount">
          <span class="totalcount">
            <i class="fas fa-file-text-o"></i> 字数统计: 7.4k |
          </span>
  
          <span class="min2read">
            <i class="fas fa-clock"></i> 阅读时长: 27分钟 |
          </span>
  
          
            <span class="reading">
              <i class="fas fa-eye"></i> 阅读量：<span id="busuanzi_value_page_pv"></span>
            </span>
          
        </div>
      
    
  </div>
  
  
    <script src="/js/bubble/bubble.js"></script>
  
</div>





<div class="row justify-position" 
  style="padding-top: 0px;">
  <div class="main-content">
    <article class="post post-detail">
      <div class="post-content">
        <h2 id="第一章"><a href="#第一章" class="headerlink" title="第一章"></a>第一章</h2><ol>
<li><p>Java最大的特点就是可以在不同的平台环境上运行。</p>
</li>
<li><p>Java Write Once，Run Anywhere！（一处编写，到处运行。）</p>
</li>
<li><p>Java体系结构中立。</p>
</li>
<li><p>Java的版本分为:JSE 标准版；JEE 企业版；JME 小设备版。</p>
</li>
<li><p>Java与C++的区别：（-3+1）去掉指针，去掉多继承，去掉运算符重载；增加自动内存分配与回收机制。</p>
</li>
<li><p>Java面向对象的特点：封继多：封装、继承、多态。</p>
</li>
<li><p>Java分布式：Java的网络编程如同从文件发送和接收数据一样简单。</p>
</li>
<li><p>Java鲁棒性：异常处理机制、自动垃圾收集处理来进行内存管理。</p>
</li>
<li><p>Java安全性：不支持指针、沙箱运行模式（Java程序的代码和数据在一定的空间执行）</p>
</li>
<li><p>Java解释执行：代码被编译为JVM字节码，字节码的执行不依赖硬件配置。这是Java可以在不同平台上运行的基础。</p>
</li>
<li><p>javac name.java name.class java name</p>
</li>
<li><p>javac是编译命令 java是解释执行命令</p>
</li>
<li><p>package 一个程序最多只能有1句，且只能放在第一句。</p>
</li>
<li><p>import可有可无，有必须放在所有的类定义之前。</p>
</li>
<li><p>JVM是运行java字节码的一台机器。（简称java虚拟机）</p>
</li>
</ol>
<h2 id="第二章"><a href="#第二章" class="headerlink" title="第二章"></a>第二章</h2><p>1.Java采用Unicode字符集，16位， ，支持大部分字符集。</p>
<p>2.Java标识符不能以数字开头，名称与大小写相关。</p>
<p>3.标识符的使用习惯：1名次首字母大写；2动名词动词首字母小写，名次首字母大写；3常量全大写；4变量首字母小写其他的大写。</p>
<p>4.Java数据类型：8个基本类型：<code>byte、short、int、long、float、double、char、boolean</code>；3个引申类型：<code>class、interface、数组</code>。</p>
<p>5.Java中逻辑类型和整数类型不能直接转换。</p>
<p>6.final修饰符号常量、其值在赋值之后不能改动。</p>
<p>7.类成员变量自动赋初值，局部变量不赋初值报错，引用作为类成员自动赋值为NULL。</p>
<p>8.Java中取消的操作符：-&gt;、*、&amp;、sizeof、其中三个与指针相关。</p>
<p>9.基本类型赋值在栈里；引用类型赋值在堆里；引用本身位于栈。</p>
<p>10.引用直接用=比较的是地址，要比较对象的实际内容，用equal()方法。</p>
<p>11.Java中逻辑操作符<code>&amp;&amp; || </code>有短路屏蔽，位操作符<code>&amp; |</code>没有。</p>
<p>12.自动类型转换：低精度到高精度；高精度到低精度需要强制类型转换。</p>
<p>13.Java是结构化程序设计语言：顺序结构、选择结构、循环结构。</p>
<p>14.switch-case中只能用整型、字符型、枚举型。</p>
<p>15.break跳到最近的｝之后；continue跳出当前循环到下一次循环，当是while时直接判断条件，for还需要进行自加操作。</p>
<p>16.带有Lable的break和continue的区别：break跳到Lable之后跳过最近的｛｝；contine跳到Lable之后进入｛｝。</p>
<p>17.返回类型不是void，必有return，return执行且只执行一次。</p>
<p>18.return返回结果、返回控制。</p>
<h2 id="第三章"><a href="#第三章" class="headerlink" title="第三章"></a>第三章</h2><p>1.类变量 实例变量 类方法 实例方。</p>
<p>2.类变量、类方法既能用类名，也能用实例名访问。</p>
<p>3.实力变量、实例方法只能用实例名访问。</p>
<p>4.类方法中只能访问类变量，类方法中不能有this和super指针。</p>
<p>5.访问权限：public、protected、包（默认）、private。</p>
<p>6.protected：1自己用；2子类用；3同一包中用。</p>
<p>7.不同访问权限的访问个体有：1类；2包；3子类；4不同包中的非子类。</p>
<p>8.构造方法是一个特殊的方法，与类名相同，无返回类型，通过new()调用。</p>
<p>9.Java中没有析构函数，系统自动回收垃圾，对于不是通过new()申请的空间，用终结处理方法finalize()</p>
<p>10.对象的声明（标识符）；实例化（用new分配空间）；初始化（赋值）。</p>
<p>11.栈：基本类型和对象引用 堆：所有的Java对象，用new产生的数据。</p>
<p>12.类成员的初始化顺序：1静态成员；2组合对象成员；3类本身其他成员。</p>
<p>13.静态成员只初始化一次。</p>
<p>14.Java包有一定的层次，对应外存上的目录结构，同一包中不能有相同的类名。</p>
<p>15.程序中没有package语句时，放入默认包中。</p>
<p>16.一个编译单元只能有一个公共类public class，公共类名与文件名相同，还可以有多个支持类。</p>
<p>17.导入的两个包中有同名类时，使用时用全名来区分。</p>
<p>18.为导入包而用类库中的类时，用全名引用；自定义的包，java+类名。</p>
<p>19.java.lang 自动加载的默认包：基本数据的封装类、数学函数、字符串、线程等。</p>
<p>20.java.util 工具类库：日期、日历、堆栈、向量、集合、哈希集。</p>
<p>21.Object类：在lang包中，所有类的基类、定义所有类应有的公共函数。</p>
<p>22.System类：在lang包中，不能实例化，所有方法均可直接引用，与系统属性相关。</p>
<p>23.Math类：在lang包中，静态方法，不声明为实例，常用Math.PI、Math.E。</p>
<p>24.String类：在lang包中，字符常量，不用new创建时由栈中引用指向常量池（不重复）；用new创建时可重复。Substring截取中间一段，trim去掉两端空格。</p>
<p>25.StringBuilder、StringBuffer：对于经常要修改的字符串，StringBuilder效率高于StringBuffer，StringBuffer在线程上是安全的，在大多实现过程中，StringBuilder要比StringBuffer快。</p>
<p>26.String相当于字符中的常量，只要值变化，内存空间就变化。</p>
<p>27.StringBuffer中的方法：append to追加、insert插入、delete删除、reverse反转。</p>
<h2 id="第四章"><a href="#第四章" class="headerlink" title="第四章"></a>第四章</h2><p>1.toString()函数，每个非基本类型中都有，未重写时默认输出为对象的内存地址。</p>
<p>2.组合：黑盒复用，依赖关系少，高效、动态。</p>
<p>3.继承：白盒复用，黏度高，易维护，破坏封装。</p>
<p>4.优先用组合。</p>
<p>5.super出现在构造方法中必须在第一行。</p>
<p>6.重写：子类修改父类已有的方法（覆盖），重写的方法名、返回类型、参数类型必须完全相同，且被重写的方法不能有更严格的访问权限，发生在多态中，无新受检异常。</p>
<p>7.重载：同一类中方法名相同参数列表不同，只能通过参数列表重载，不能通过访问权限、返回类型、抛出异常重载；重载可以有不同的返回类型、访问权限、异常，但是不作为重载的标志。</p>
<p>8.抽象类abstract抽象类不能实例化，类中有抽象方法，abstract class a1｛abstract void test()；｝函数声明之后有｛｝就算实现。</p>
<p>9.构造方法、静态方法、final方法不能使用abstract修饰。</p>
<p>10.接口默认为抽象类，实际上接口是抽象抽象类。</p>
<p>11.final类不能被继承，因此final类中的成员函数没有机会被覆盖，默认都是final的。</p>
<p>12.final方法：如果一个类不允许其子类覆盖某个方法，将这个方法声明为final。</p>
<p>13.将类方法声明为final更加高效，编译时绑定，静态绑定。</p>
<p>14.final变量常量，修饰的成员的值一旦给定就无法改变：静态变量、实例变量、局部变量。</p>
<p>15.static和final变量能够自动赋值为默认值。</p>
<p>16.this()本类的构造函数 this.本类的变量或方法</p>
<p>Super()超类的构造函数 super.超类的变量或方法</p>
<ol start="16">
<li><p>子类和超类有重名变量时，用this和super区分。</p>
</li>
<li><p>向上转型：子类转型为超类；超类的引用指向子类的对象。</p>
</li>
<li><p>超类的引用不能调用：1子类中定义而超类中没有定义的方法；2子类重写的方法。</p>
</li>
<li><p>只能将子类类型的引用赋值给超类类型的引用。</p>
</li>
<li><p>每个类实例对象都自带一个虚函数表，这个表中存储的是指向虚函数的指针。</p>
</li>
<li><p>超类和子类中都有的方法，才有多态的动态绑定问题。</p>
</li>
<li><p>重写的重要特征：除了函数的实现以外其他部分都相同；覆盖：均相同才能覆盖。</p>
</li>
<li><p>Java中所有的成员方法都包含在虚表中，而C++中只有声明为virtual才是虚函数。</p>
</li>
<li><p>动态绑定和静态绑定的适用条件：静态：private、static、final、构造函数。</p>
</li>
<li><p>动态绑定的过程中，先在对象的实际类型的虚表中匹配，找不到的话再上溯到它的基类的虚表中找。</p>
</li>
<li><p>this指针始终指的都是实际类型。</p>
</li>
<li><p>动态绑定指的是成员方法，成员变量始终都是静态绑定。</p>
</li>
<li><p>想要动态的调用变量成员，将变量成员封装在方法中返回。</p>
</li>
<li><p>重写是覆盖，同名的方法仅有一个；重载是并列，哪个参数匹配调用哪个。</p>
</li>
<li><p>多态的三种实现方式：1继承实现；2抽象类实现；3接口实现。</p>
</li>
<li><p>接口中只有常量和抽象方法。</p>
</li>
<li><p>Java接口中的成员变量默认都是public static final类型的，这些关键字都可以省略，但是必须初始化。</p>
</li>
<li><p>Java接口中的方法默认都是public abstract类型，不能有方法体，不能实现。</p>
</li>
<li><p>抽象类和接口的区别：抽象类中可以有写实的方法，但至少要有一个方法是抽象的；接口中所有的方法都必须是抽象的。</p>
</li>
<li><p>Java接口中只能包含public static final成员变量和public abstract成员方法。</p>
</li>
<li><p>接口继承接口，类实现接口，类继承类。</p>
</li>
<li><p>Java接口必须通过类来实现。</p>
</li>
<li><p>类实现接口时，当所有的方法没有全部被写实时，类应该声明为抽象类。</p>
</li>
<li><p>不允许创建接口实例，但是允许定义接口的引用指向实现了该接口的类实例对象。（类似于向上转型）</p>
</li>
<li><p>抽象类只能在继承体系中实现，而接口可以任意实现。</p>
</li>
<li><p>接口中的常量可以是不定常量，其值会在第一次访问是建立，然后保持不变。</p>
</li>
<li><p>内部类的访问权限控制符有：<code>public、default、protected、private</code>，嵌套内部类static。</p>
</li>
<li><p>创建非静态内部类时，一定要先创建其相应的外部类对象。</p>
</li>
<li><p><code>outerclass.innnerclass innerobject=outerobject.new innerclass()</code></p>
</li>
<li><p>创建嵌套类对象时，不需要创建其外部类对象。</p>
</li>
<li><p><code>outerclass.innnerclass innerobject=outerclass.new innerclass()</code></p>
</li>
<li><p>静态内部类不能访问外部类的非静态成员。</p>
</li>
<li><p>局部内部类：定义在一个方法或一个语句块中。</p>
</li>
<li><p>局部内部类访问外部类的局部变量时，只能访问final类型的。</p>
</li>
<li><p>局部内部类的访问优先级：内部类&gt;外部类&gt;局部final变量。</p>
</li>
<li><p>内部类的作用：允许protected和private权限，实现更小层次的封装。</p>
</li>
<li><p>内部类一般与接口联合使用，更好的实现多重继承。</p>
</li>
<li><p>匿名内部类：new 接口名(){} new 超类名(){}</p>
</li>
<li><p>内部类编译时生成的.class文件outerclassname$innerclassname.class 匿名内部类outerclassname$#.class #为数字，从1开始，每生成一个，数字递增1。</p>
</li>
<li><p>在内部类中调用this和new返回一个外部类时的不同，this得到的是创建该内部类的外部类对象的引用；而new创建一个新的引用。</p>
</li>
<li><p>有内部类的实例作为外部类的成员时，构造该外部类时，先创建内部类的成员实例，再创建外部类实例的其他成员。（相当于组合关系）</p>
</li>
<li><p>一个外部类的内部类被另一个类继承时，在该子类的构造方法中用外部类的一个实例调用超类的构造函数。Outerobject.super()。</p>
</li>
<li><p>一般的super()调用默认的都是extends类名中的构造函数。</p>
</li>
<li><p><code>class son extends father&#123;super();&#125;</code></p>
</li>
<li><p><code>class son extends father.innerclass&#123;fatherobject.super();&#125;</code></p>
</li>
</ol>
<h2 id="第五章"><a href="#第五章" class="headerlink" title="第五章"></a>第五章</h2><p>1.AWT：重量级控件：靠本地方法实现其功能，不同的平台上不统一。</p>
<p>2.Swing：轻量级控件：提供了AWT的所有功能，并大幅扩充。</p>
<p>3.Swing中除了JFrame、JApplet、JDialog、JWindow之外都是轻量级控件。</p>
<p>4.Button在AWT中，JButton在Swing中；其他的名称类似。</p>
<p>5.Java采用向容器中添加组件的方式构建图形界面，通常用顶级容器作为所有组件的承载物。</p>
<p>6.容器之间可以完全嵌套。</p>
<p>7.GUI组件分为：容器类、控件类、辅助类。</p>
<p>8.常用的组件及相关函数</p>
<figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><span class="line">JFrame（窗口）：setsize、setvisible、setlocation、setdefaultcloseoperation、getcontentpane</span><br><span class="line"></span><br><span class="line">JButton（按钮）：settext、seticon、setbounds、addactionlistener</span><br><span class="line"></span><br><span class="line">JLable（标签）：settext、seticon、settooltiptext、sethorizontextposition</span><br><span class="line"></span><br><span class="line">JTextField（文本框）：addactionlistener、setcolums、settext</span><br><span class="line"></span><br><span class="line">JRadioButton（单选框）；JDialog（对话框）；JFileChooser（文件对话框）；JComboBox（组合框）：JTextField（文本域）、JMenu（菜单）。</span><br></pre></td></tr></table></figure>
<p>9.布局管理：Container中有一个方法交setLayout()</p>
<p>10.不同的布局方式有：1BorderLayout；2FlowLayout；3GridLayout</p>
<p>11.BorderLayout是JFrame的默认布局，组件分为5个区域，东西南北中。</p>
<p>12.add(位置，组件)</p>
<p>13.FlowLayout顺序布局：从左到右、从上到下、</p>
<p>14.GridLayout网格布局：组件在网格中从左到右、从上到下。</p>
<p>15.事件处理：1事件；2源事件；3事件处理者。</p>
<p>16.事件处理的步骤：1注册事件监听器；2外部作用于事件源；3生成事件对象；4将事件对象传给事件处理器；5事件处理器进行处理。</p>
<p>17.定义监听器：actionPerformed、new创建监听器对象、注册监听器add***actionlistener()</p>
<p>18.监听器的三种实现方式：1实现注册写实；2内部类；3匿名内部类的实现。</p>
<p>19.GUI编程中要用的三个包：import java.awt.*；import javax.swing.*；import java.awt.event.*。</p>
<p>20.适配器：Adapter：适配器产生的必要性：接口中有很多抽象函数未写实，当要用到其中的某个功能时，需要全部写实，带来不便；适配器实现了所有方法却不做任何事情，可被继承然后只需写实要用到的那个方法而不用管其他方法。</p>
<p>21.适配器是处于接口和类之间的一个过渡性产物，省去很多实现的麻烦。</p>
<h2 id="第六章"><a href="#第六章" class="headerlink" title="第六章"></a>第六章</h2><p>1.异常的分类：1Exception经过处理能恢复正常，不中断现有程序；2Error无法恢复必须中断现行程序退出。</p>
<p>2.常见的异常：ArithmeticExption数学异常、OutofMemory内存溢出异常、NullPointerExption空指针异常、IndexOutofMemoryExption下标边界异常。</p>
<p>3.错误由JVM抛出。</p>
<p>4.异常分为受检异常和不受检异常：1不受检异常（编译器可处理）：不要求程序员处理，最终可从main()抛出并用printStackTrace()一般是逻辑错误，包括RuntimeException和Error及其子类；2受检异常：强制程序员检测和处理。</p>
<p>5.异常的处理方法：1用try-catch-finally结构捕获和处理；2将异常层层向上抛直至转交给JVM处理。</p>
<p>6.多个catch块时只会匹配其中一个异常类并执行catch的代码，catch匹配的顺序是从上到下。</p>
<p>7.无论try语句块是否发生异常，finally语句块都是要执行的。</p>
<p>8.<code>try-catch-finally</code>三个语句块不能单独使用，可组成<code>try-catch-finally</code>、<code>try-catch</code>、<code>try-finally</code>三种结构，catch块可以有多个，finally块只能有一个。</p>
<p>9.try-catch-finally块中的变量的作用域为语句块内部，分别独立不能相互访问。</p>
<p>10.catch块的参数有父子关系时，子类在前，父类在后。</p>
<p>11.返回类型+函数名称+形参列表+throws Exception{}</p>
<p>12.异常传递链：不处理不执行，方法在抛出异常的地方退出，不想终止方法就用try来捕获异常。</p>
<p>13.自定义异常在构造函数中super()来调用Exception类的构造函数。</p>
<p>14.throws方法声明时放在方法中，throw在方法体中，在一个具体的动作。</p>
<p>15.如果抛出的异常一直未被处理，沿函数一直往上抛，从主函数中抛出之后由JVM处理，此时可以调用printStackTrace()打印这一异常所在的位置、类型等信息。</p>
<h2 id="第七章"><a href="#第七章" class="headerlink" title="第七章"></a>第七章</h2><p>1.Java中数组的下标从0开始编号，数组中除了元素之外还存在唯一的可被访问的属性length。</p>
<p>2.数组声明：类型[]数组名 类型 数组名[] []表示数组类型</p>
<p>3.数组的初始化：静态初始化、动态初始化。</p>
<p>4.静态初始化：[]中没有数字，各个元素的值显性给出。</p>
<p>5.动态初始化：[]中有数字或变量，用关键字new，数组中各个元素可以自动赋值。</p>
<p>6.new申请空间时在堆上，在堆上均可自动赋值。</p>
<p>7.对象数组的初始化：类型[]数组名=new 类型{new 构造方法()…}</p>
<p>8.对于大型的数组或对象数组，一般结合循环语句来赋值。</p>
<p>9.多维数组：n维数组中存放着n-1维数组的引用。</p>
<p>10.不规则数组：数组元素引用的数组长度不等：a.length指的是第一维数组长度；a[i].length指的是对应维数数组的长度。</p>
<p>11.数组是一个特殊的对象，数组名存放一个对象的引用。</p>
<p>12.数组名实质是一个引用，所以可以作为参数。</p>
<p>13.数组工具类：Arrays，类函数：copyof数组中的值拷贝；sort升序排序；binarysearch查找特定值；equals判断两个数组是否相等。</p>
<p>14.对象比较接口：<code>java.lang.comparable int compareTo(Object o)</code></p>
<p><code>java.util.comparator int compare(Object o1, Object o2)</code></p>
<p>15.一个类用sort比较大小时，自动调用compareTo方法比较大小。</p>
<p>16.枚举：有限的、不变的值的集合。</p>
<p>17.enum类型变量只能保存声明时给定的枚举值。</p>
<p>18.数组：静态容量，容量的一开始就定了。</p>
<p>19.类集Collection，是动态容量：有两个子集：1List对象有顺序，允许重复；2Set无序，不能重复。</p>
<p>20.Map映射：键值对，键是唯一的，值可以重复。</p>
<p>21.List：(有顺序，靠下标索引)<code>ArrayList LinkedList</code></p>
<p>22.<code>List l=new ArrayList()</code>，改变集合类型时代码不用变化，类似于接口引用一个实现了它的类，当使用类特有的方法时，不能用接口定义，而应该使用具体的类。</p>
<p>23.ArrayList数组内部维护了一个Object类型的数组；LinkedList内部维护了一个有头结点的双向链表。</p>
<p>24.使用LinkedList可以很简单的构造堆栈、队列，addFirst、addLast、getFirst、getLast、removeFirst。</p>
<p>25.泛型，C++中的模版，声明泛型时，使用尖括号指定类型参数，应用时用具体的类型填入类型参数。</p>
<p>26.泛型：类模版、函数模版。</p>
<p>27.声明 class 类名&lt;类型参数列表&gt;{}</p>
<p>28.应用 类名&lt;具体的类型列表&gt;变量名=new类名&lt;具体的类型列表&gt;(构造函数的参数列表)。</p>
<p>29.类、接口、方法都能使用泛型。</p>
<p>30.集合Set：不允许重复，无下标索引，常用的集合<code>HashSet、TreeSet、LinkedHashSet</code>。</p>
<p>31.system.out.println(set)用结合作为参数能直接输出结合中的元素，输出形式为[…,…,…]</p>
<p>32.迭代器：Iterator设计模式、对象，特别为遍历无索引的集合而准备。</p>
<p>33.Iterator中的函数：next()首次使用时，返回序列的第一个元素，之后获得序列中的下一个元素并向后移；hasnext()判断是否有下一个。</p>
<p>34.迭代器的使用：判断it.hasnext();取出类型=it.next()</p>
<p>35.for-each遍历，对迭代器进行了包装，代码更加简洁，只能遍历两种类型：1数组；2实现了Iterator接口的实例。</p>
<p>36.哈希集：HashSet：用哈希表和哈希算法实现快速查找，折中了数组和链表，内部维护了一个链表数组，拥有常数查找时间，要求对象重写hashCode、和equal方法。</p>
<p>37.哈希表类似于邻接表，散列、Cache映射寻址中的组相连。</p>
<p>38.哈希表工作的两大步骤：1获得哈希码，算出该插入哪个链表；2在链表上比较。</p>
<p>39.容量：链表数组的大小，载入因子，重构的条件；当元素数目&gt;容量*载入因子时，重构翻倍。</p>
<p>40.HashSet中没有相同的元素，所以内容equals的对象，hashcode一定也相等，hashcode不相等的两个对象一定不equals。</p>
<p>41.hashcode默认返回的是内存地址，equals默认比较的也是内存地址。</p>
<p>42.哈希集中一般选一个不重复的关键词作为哈希码。</p>
<p>43.TreeSet元素间有序但不能重复，，自平衡二叉树，必须实现comparable和compator接口来比较，写实equal保证唯一性，查找效率为 。</p>
<p>44.LinkedHashSet哈希集+链表，在HashSet基础上将元素串起来，元素有序。</p>
<p>45.输入同一组数据，用不同的集输出，HashSet元素存放无序，LinkedHashSet保持添加顺序，TreeSet按排序存放。</p>
<p>46.key-value关系对的无序容器，键值均为对象，键值对也为对象。</p>
<p>47.一个映射Map中不能有相同的key，每个key只能有一个value</p>
<p>48.Map不能用迭代器，无序，无法索引。</p>
<p>49.遍历Map时，通过将映射转换为键或值来进行遍历。</p>
<p>50.List Set Map为接口，不能实例化。</p>
<p>51.泛型&lt;&gt;的位置，函数：在访问控制符之后，类，接口在名称之后。理解：必须在可能出现类型的地方之前</p>
<p>52.collection是list和set的父类，collection工具类，静态类，有常用的操作。</p>
<h2 id="第八章"><a href="#第八章" class="headerlink" title="第八章"></a>第八章</h2><p>1.创建好的输入输出系统是艰难的工作：1与不同的源和目的端进行交互；2以不同的方式进行通信；3大多数I/O需要异常处理。</p>
<p>2.Java通过各种封装的流类完成输入输出工作。</p>
<p>3.流：想象中无限长的数据序列1输入流输出流；2字符流字节流；3节点流处理流。</p>
<p>4.字节输入：InputStream、字节输出OutputStream、字符输入Reader、字符输出Writer。</p>
<p>5.<code>ByteArrayInputStream</code>：将内存的缓冲区来当作InputStream使用。</p>
<p>6.<code>StringBufferInputStream</code>：将String转换成InputStream。</p>
<p>7.<code>FileInputStream</code>：从文件中读取信息。</p>
<p>8.<code>PipedInputStream</code>：产生用于写入相关数据，实现管道化。</p>
<p>9.<code>ObjectInputStream</code>：对象序列化输入流。</p>
<p>10.<code>SequenceInputStream</code>：将两个或多个InputStream对象转换成单一的InputStream。</p>
<p>11.<code>DataInputStream</code>：从流中读取基本的数据类型(int char long…)</p>
<p>12.<code>BufferedInputStream</code>：使用缓冲区读入，防止每次读取都要进行操作破坏硬盘。</p>
<p>13.<code>LineNumberInputStream</code>：跟踪输入流的行号。</p>
<p>14.节点流：从特殊位置读写的基本功能。</p>
<p>15.处理流：结合其他流的基础上，修改管理数据并提供额外功能。</p>
<p>16.常见的处理流：1缓冲Buffered；2过滤：Filter；3转换InputStreamReader；4对象序列化ObjectInputStream；5打印PrintStream。</p>
<p>17.缓冲流：不直接读写，对硬盘损害小，嵌套在其他节点流之上，提高效率。</p>
<p>18.缓冲流在构造时，一般有两个参数：1要包装的流类；2要缓冲的数据的大小。</p>
<p>19.mark标记流中当前的位置；reset定位到最近的标记点；readline读一行；flush刷新。</p>
<p>20.打印流，不抛异常，自动刷新。</p>
<p>21.数据流：支持基本类型的输入输出，继承自<code>InputStream、OutputStream</code>。</p>
<p>22.流的难点在于：搞清格流之间的关系，流之间如何嵌套，如何用一个流若为参数来构造另一个流。</p>
<p>23.处理流需要在节点流的基础上封装构造，所以识别基本的节点流和处理流是一项基本功。</p>
<p>24.处理流在使用完毕之后要调用close函数，处理流是动态的，不关一直起作用。</p>
<p>25.标准I/O流，<a target="_blank" rel="noopener" href="http://system.in键盘输入;system.out屏幕输出;system.err错误输出./">http://System.in键盘输入；System.out屏幕输出；System.err错误输出。</a></p>
<p>26.各种流类的嵌套定义和初始化时遵循一个原则，简单的被复杂的嵌套，简单的作为复杂的参数。</p>
<p>27.Scanner类：扫描输入文本，除了可用正则表达式之外，还可分析字符串和基本类型。</p>
<p>28.Scanner的使用： <code>Scanner s=new Scanner(http://System.in) int ss=s.nextInt()</code></p>
<p>29.使用输入输出时导入一个包import java.io.*;</p>
<p>30.使用Scanner是import java.util.*;</p>
<p>31.文件输入输出流：<code>FileInputStream、FileOutputStream 、FileReader、FileWriter</code>。</p>
<p>32.File类的构造：<code>public File(String pathname)</code>相对路径、绝对路径、父路径、子路径。</p>
<p>33.mkdir创建文件夹 mkdirs在不存在为文件中创建文件夹</p>
<p>34.有关文件的输入输出：<code>int b=0，while((b=in.reader()!=-1))&#123;&#125;</code></p>
<p>35.随机访问文件：适用于大小已知的记录组成的文件，seek到指定位置，getFilePointer得到当前指针位置。</p>
<p>36.length判断文件大小。</p>
<p>37.RandomAccessFile生成随机访问文件。</p>
<h2 id="第九章"><a href="#第九章" class="headerlink" title="第九章"></a>第九章</h2><p>1.系统级并发，单个的一段程序执行控制流称为线程。</p>
<p>2.多线程：一个程序内有多个相同或不同的线程或执行不同的任务。</p>
<p>3.多线程的作用：1提高UI的响应速度；2提高硬件资源的利用率；3隔离高速硬件和低速硬件；4提供程序上的隔离不同的运行模块。</p>
<p>4.实现多线程的程序设计关键：获得Thread实例，重写run方法，调用start方法开始线程并分配资源。</p>
<p>5.从run方法中返回是退出线程唯一正确的方法。</p>
<p>6.start是线程从系统外分配资源，run是线程获得资源后要进行的工作。</p>
<p>7.线程类Thread是Object的直接子类，成员属性：PRIORITY优先级。</p>
<p>8.Thread的成员方法：sleep休眠指定的秒数，start启动线程，yield挂起暂停，run执行，notify唤醒。</p>
<p>9.isLive判断线程是否处于活动状态，getName返回线程名称，currentThread返回正在执行的线程的引用。</p>
<p>10.继承Thread：1继承Thread类；2重写run方法；3new创建新对象；4调用start启动线程。</p>
<p>11.线程的不确定性：同一线程内执行的顺序是一定的，多个线程执行顺序有多种组合。</p>
<p>12.用继承Thread类的方式实现多线程，被Java多继承的限制不能再继承别的类。</p>
<p>13.用实现Runnable方法实现多线程：（更加通用的多线程方法），1实现Runnable方法；2重写public void run(){}；3用new来实例新对象；4调用start启动线程。</p>
<p>14.通过继承和实现两种方法形成的线程类在使用时有区别：1继承实现的线程类能直接实例化；2通过实现的线程类实例化之后作为new Thread()的参数。</p>
<p>15.线程的生命周期：出生、就绪、运行、休眠、等待、阻塞、死亡。</p>
<p>16.两个线程的依赖关系：某格线程在另一个线程终止时才能继续执行，可调用另一个join的方法当另一个线程死亡时，该线程从等待态进入就绪态。</p>
<p>17.线程被创建时，从父线程中继承优先级，创建之后也能改变优先级。</p>
<p>18.优先级定义分为10级。</p>
<p>19.线程优先级的作用：方便操作系统的调度，优先级相同且不实用分时技术时，一个运行完才运行下一个，除非他自己变为其他状态。</p>
<p>20两个线程同时访问一个成员，造成对共享数据的冲突，造成一致破坏，为保证数据的一致性，引入同步锁sunchronized</p>
<p>21.同步分为方法同步和语句同步，方法同步在函数类型之前加sunchronized；语句同步在{}之前加sunchronized。</p>
<p>22.协作机制：生产者消费者模型。</p>
<p>23.死锁的解决：1逻辑隔离：每个同步区使用各自的锁；2尽快释放：使用完尽快释放锁对象；3按顺序申请：用到多格锁对象的申请一致。</p>
<h2 id="第十章"><a href="#第十章" class="headerlink" title="第十章"></a>第十章</h2><p>1.数据库的组成：数据库、数据库管理系统、应用系统、数据库管理员、数据库用户。</p>
<p>2.数据类型：网状模型、层次模型、关系模型。</p>
<p>3.关系模型数据库是目前最流行的数据库。</p>
<p>4.数据库的数据有最小的冗余度和较高的数据和程序独立。</p>
<p>5.SQL语言，常见的SQL查询命令</p>
<p>查询：<code>selsct…from…where</code></p>
<p>操纵：<code>insert、updata、delete</code></p>
<p>定义：<code>creat、alter、drop</code></p>
<p>6.JDBC是为了JAVA专门和数据库交互的一套接口，用于执行SQL语句的JavaAPI。</p>
<p>7.JDBC的基本功能：1加载JDBC驱动程序；2建立与数据库的联系；3使用SQL语言进行数据库操作和处理结果；4关闭相关链接。</p>
<p>8.写数据库程序要导入的包：  <code>import java.sql.*</code>。</p>
<h2 id="鸣谢"><a href="#鸣谢" class="headerlink" title="鸣谢"></a>鸣谢</h2><ul>
<li>感谢b站动力节点的视频，连接附上<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV1Rx411876f">https://www.bilibili.com/video/BV1Rx411876f</a></li>
<li>感谢老马的b站视频，链接附上<a target="_blank" rel="noopener" href="https://www.bilibili.com/video/BV16s411k7XJ">https://www.bilibili.com/video/BV16s411k7XJ</a></li>
<li>java聊天室源码附上，提供学习交流<a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux/java-chat">https://gitee.com/yangyang-linux/java-chat</a></li>
</ul>

      </div>
      <div class="post-tags-categories">
        
        <div class="tags">
          
            <a href="/tags/JAVA/" class="">
              JAVA
            </a>
          
        </div>
        
      </div>
      
        <div class="copyright">
  <ul class="post-copyright">
    <li class="post-copyright-author">
    <strong>作者:  </strong>阳阳</a>
    </li>
    <li class="post-copyright-link">
    <strong>文章链接:  </strong>
    <a href="/2020/10/01/2020-10-01-java-bi-ji-wu/" target="_blank" title="Java笔记(五)">https://yangyang-linux.gitee.io/2020/10/01/2020-10-01-java-bi-ji-wu/</a>
    </li>
    <li class="post-copyright-license">
      <strong>版权声明:   </strong>
      本网站所有文章除特别声明外,均采用 <a rel="license" href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" title="Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)">CC BY-NC-ND 4.0</a>
      许可协议。转载请注明出处!
    </li>
  </ul>
<div>
      
    </article>
    <!-- 上一篇文章和下一篇文章 -->
    
      <!-- 文章详情页的上一页和下一页 -->
<div class="post-nav">



  
  <div class="post-nav-prev post-nav-item">
    <div class="post-nav-img" style="background-size: cover; 
      background-position: center center;">
      <img class="lazyload lazyload placeholder" src="/medias/13.jpg" class="lazyload placeholder" data-srcset="/medias/13.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="">
    </div>
    <a href="/2020/10/01/2020-10-01-java-bi-ji-er/" class="post-nav-link">
      <div class="title">
        <i class="fas fa-angle-left"></i> 上一篇:
        <div class="title-text">Java笔记</div>
      </div>
      
      <!-- <div class="content">
        一 HelloWorld大多数程序员第一个程序是HelloWorld开始，所以今天我们也从这里开始。PS：大家一定记得，
      </div> -->
    </a>
  </div>



  
  <div class="post-nav-next post-nav-item">
    <div class="post-nav-img" style="background-size: cover; 
      background-position: center center;">
      <img class="lazyload lazyload placeholder" src="/medias/13.jpg" class="lazyload placeholder" data-srcset="/medias/13.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" src="" alt="">
    </div>
    <a href="/2020/10/01/2020-10-01-java-bi-ji-san/" class="post-nav-link">
      <div class="title">
        下一篇: <i class="fas fa-angle-right"></i>
        <div class="title-text">Java笔记</div>
      </div>
      <!-- <div class="content">
        为什么要设置环境变量首先要问一个问题，Windows操作系统时如何搜索硬盘上某个命令的呢？

首先会从当前目录下搜索，比
      </div> -->
    </a>
  </div>

</div>

    
    

    <!-- 打赏 -->
    
      <div id="appDonate" class="post-donate">
  <div id="donate_board" class="donate_bar center" ref="donate">
    <a id="btn_donate" class="btn_donate" href="javascript:;" title="打赏" @click="showDialogDrawer()"></a>
  </div>
  <transition name="fade">
    <div 
      class="donate-box-mask"
      v-cloak 
      v-show="visible"
      @click="cancelDialogDrawer()"
    >
    </div>
  </transition>
  <transition name="bounce">
    <div class="donate-box" v-cloak v-show="visible">
      <div class="donate-box_close">
        <i class="fas fa-times" aria-hidden="true" @click="cancelDialogDrawer" pointer></i>
      </div>
      <div class="donate-box_title">
        <h4>
          你的赏识是我前进的动力
        </h4>
      </div>
      <div class="donate-box_tab">
        <div class="Alipay" pointer :class="{'active': tabActive === 'Alipay'}" @click="changeTabActive('Alipay')">
          支付宝
        </div>
        <div class="WeChatpay" pointer :class="{'active': tabActive === 'WeChatpay'}" @click="changeTabActive('WeChatpay')">
          微信
        </div>
      </div>
      <div class="donate-box_img">
        <div class="AlipayImg" v-show="tabActive === 'Alipay'">
          <img src="/medias/zfb.jpg" class="lazyload placeholder" data-srcset="/medias/zfb.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="支付宝打赏" />
        </div> 
        <div class="WeChatpayImg" v-show="tabActive === 'WeChatpay'">
          <img src="/medias/wx.jpg" class="lazyload placeholder" data-srcset="/medias/wx.jpg" srcset="https://img10.360buyimg.com/ddimg/jfs/t1/157667/29/9156/134350/603c6445Ebbc9cabe/41219c5d36d45072.gif" alt="微信打赏" />
        </div>
      </div>
    </div>
  </transition>
</div>

<script>
  var body = document.body || document.documentElement || window;
  var vm = new Vue({
    el: '#appDonate',
    data: {
      visible: false,
      tabActive: 'Alipay',
      top: 0,
    },
    computed: {
    },
    mounted() {
    },
    methods: {
      showDialogDrawer() {
        this.visible = true;
        // 防止页面滚动，只能让弹框滚动
        // function getScroll() {
        //   return {
        //     left: window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft || 0,
        //     top: window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop || 0
        //   };
        // }
        this.top = $(document).scrollTop() // or getScroll().top
        // console.log('aa', $('.main-content'));
        body.style.cssText = 'overflow: hidden;';
      },
      cancelDialogDrawer() {
        this.visible = false;
        body.removeAttribute('style');
        $(document).scrollTop(this.top)
      },
      changeTabActive(name) {
        this.tabActive = name;
      }
    },
    created() {}
  })
</script>
    

    <!-- 分享 -->
    
      <!-- https://github.com/overtrue/share.js -->
<!-- 文章详情页的分享 -->
<div class="social-share" data-sites="twitter,facebook,google,qq,qzone,wechat,weibo,douban,linkedin" data-wechat-qrcode-helper="<p>微信扫一扫即可分享！</p>"></div>

<script src="/js/shareJs/social-share.min.js"></script>
</script>

<style>
  .social-share {
    margin: 20px 0;
  }
</style>


    
    
    <!-- 评论 -->
    <!-- 评论 -->

  <div id="myComment">
    
      
<section id="comments" style="padding: 1em; margin: 15px auto;"
	class="animated bounceInUp">
	<div id="vcomment" class="comment"></div>
</section>
<style>
	#comments {
		background: rgba(255,255,255,0.9);
	}
	#veditor {
		background-image: url('https://img.zcool.cn/community/01a253594c71cfa8012193a329a77f.gif');
		background-size: contain;
		background-repeat: no-repeat;
		background-position: right;
		background-color: rgba(255, 255, 255, 0);
		resize: vertical;
	}
	#veditor:focus{
		background-position-y: 200px;
		transition: all 0.2s ease-in-out 0s;
	}
	#vcomment .vcards .vcard .vh .vhead .vtag.vvisitor {
		background-color: #42b983;
	}
	.v[data-class=v] .vbtn:active, .v[data-class=v] .vbtn:hover {
		color: #42b983;
		border-color: #42b983;
	}
	#vcomment .vcards .vcard .vhead .vsys i {
		display: none;
	}
	/* 底部valine链接 */
	#vcomment .vpower {
		display: none;
	}
	
	/* 底下注释是修改 名称和邮箱和网址输入框的样式 */
	/* #vcomment .vheader {
		display: flex;
		justify-content: space-around;
	}
	
	#vcomment .vheader .vnick {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	}

	#vcomment .vheader .vmail {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	}

	#vcomment .vheader .vlink {
		width: 31%;
		border: 2px solid #dedede;
		padding-left: 10px;
		padding-right: 10px;
		border-radius: 5px
	} */

	img.vimg {
		transition: all 1s;
		/* 头像旋转时间为 1s */
	}

	img.vimg:hover {
		transform: rotate(360deg);
		-webkit-transform: rotate(360deg);
		-moz-transform: rotate(360deg);
		-o-transform: rotate(360deg);
		-ms-transform: rotate(360deg);
	}

	#vcomment .vcards .vcard {
		padding: 15px 20px 0 20px;
		border-radius: 10px;
		margin-bottom: 15px;
		box-shadow: 0 0 4px 1px rgba(0, 0, 0, .12);
		transition: all .3s
	}

	#vcomment .vcards .vcard:hover {
		box-shadow: 0 0 8px 3px rgba(0, 0, 0, .12)
	}

	#vcomment .vcards .vcard .vh .vcard {
		border: none;
		box-shadow: none;
	}
</style>
    
  </div>

<!-- comment script in themes\hexo-theme-bamboo\layout\_partial\scripts\index.ejs -->


  </div>

  <!-- 目录 -->
  <!-- 文章详情页右侧目录 -->

  <div class="toc-aside">
    <div class="toc-main">
      <div class="toc-aside-title">
        <i class="fas fa-list-ul" aria-hidden="true"></i><span>本文目录</span>
        
          <div class="toc-open-close">本文目录</div>
        
      </div>
      <div class="toc-content">
        <div class="toc"></div>
      </div>
    </div>
  </div>

  <!-- 手机端目录按钮 -->
  <div id="toc-mobile-btn">
    <i class="fas fa-list-ul" aria-hidden="true"></i>
  </div>


<script>
  function closeToc(init) {
    $(".toc-aside").css({'width': 0, 'padding': 0, 'transition': init ?  'noe' : 'width 0.3s' });
    $(".toc-content").css({'width': 0});
    $(".toc-aside-title span, .toc-aside-title i").css({'display': 'none'});
    $(".main-content").css({'width': '75%', 'margin': '10px auto'});
  };
  function openToc() {
    $(".main-content").css({'width': '65%', 'margin-right': '10px', 'margin-left': 'calc(35% - 350px)'});
    $(".toc-aside").css({'width': '300px', 'padding': '0 10px', 'transition': 'width 0.3s'});
    $(".toc-content").css({'width': '300px'});
    $(".toc-aside-title span, .toc-aside-title i").css({'display': 'inline-block'});
  }
  function openBtnClickFn () {
    let openOrCloseBtn = $('.toc-aside .toc-aside-title .toc-open-close');
    let open = eval('' || 'false');
    openOrCloseBtn.click(function() {
      if (open) {
        closeToc();
        open = false;
      } else {
        openToc();
        open = true;
      }
    });
  };
  openBtnClickFn();
  initCloseTocWidth(true);

  function initCloseTocWidth(init) {
    if (window.innerWidth >= 992) {
      let isClose = true;
      isClose && closeToc(init)
    }
  }

  document.addEventListener('pjax:complete', function () {
    $(".toc-aside").css({'transition': 'no'});
  })
  document.addEventListener('pjax:complete', function () {
    openBtnClickFn();
  })
  
</script>

  <!-- 图片放大 Wrap images with fancybox support -->
  <script src="/js/wrapImage.js"></script>
</div>

<!-- 文章详情页背景图 -->
<div id="appBgSwiper" style="position: fixed;left: 0;top: 0;width: 100%;height: 100%;z-index: -2;"
	:style="{'background-color': bgColor ? bgColor : 'transparent'}">
	<transition-group tag="ul" :name="names">
		<li v-for='(image,index) in img' :key='index' v-show="index === mark" class="bg-swiper-box">
			<img :src="image" class="bg-swiper-img no-lazy">
		</li>
	</transition-group>
</div>
<script>
	var vm = new Vue({
		el: '#appBgSwiper',
		data: {
			names: '' || 'fade' || 'fade', // translate-fade fade
			mark: 0,
			img: [],
			bgColor: '',
			time: null
		},
		methods: {   //添加方法
			change(i, m) {
				if (i > m) {
					// this.names = 'fade';
				} else if (i < m) {
					// this.names = 'fade';
				} else {
					return;
				}
				this.mark = i;
			},
			prev() {
				// this.names = 'fade';
				this.mark--;
				if (this.mark === -1) {
					this.mark = 3;
					return
				}
			},
			next() {
				// this.names = 'fade';
				this.mark++;
				if (this.mark === this.img.length) {
					this.mark = 0;
					return
				}
			},
			autoPlay() {
				// this.names = 'fade';
				this.mark++;
				if (this.mark === this.img.length) {
					this.mark = 0;
					return
				}
			},
			play() {
				let bgImgDelay = '' || '180000'
				let delay = parseInt(bgImgDelay) || 180000;
				this.time = setInterval(this.autoPlay, delay);
			},
			enter() {
				clearInterval(this.time);
			},
			leave() {
				this.play();
			}
		},
		created() {
			this.play()
		},
		beforeDestroy() {
			clearInterval(this.time);
		},
		mounted() {
			let prop = '' || 'https://pic4.zhimg.com/80/v2-5030587bac1b856d09e0a119ff6d7c04_1440w.jpg,https://api.btstu.cn/sjbz/api.php';
			let isImg = prop.includes('.bmp') || prop.includes('.jpg') || prop.includes('.png') || prop.includes('.tif') || prop.includes('.gif') || prop.includes('.pcx') || prop.includes('.tga') || prop.includes('.exif') || prop.includes('.fpx') || prop.includes('.psd') || prop.includes('.cdr') || prop.includes('.pcd') || prop.includes('.dxf') || prop.includes('.ufo') || prop.includes('.eps') || prop.includes('.ai') || prop.includes('.raw') || prop.includes('.WMF') || prop.includes('.webp') || prop.includes('.jpeg') || prop.includes('http://') || prop.includes('https://')
			if (isImg) {
				let img = prop.split(',');
				let configRoot = '/'
				let arrImg = [];
				img.forEach(el => {
					var Expression = /http(s)?:\/\/([\w-]+\.)+[\w-]+(\/[\w- .\/?%&=]*)?/;
					var objExp = new RegExp(Expression);

					if (objExp.test(el)) {
						// http or https
						arrImg.push(el);
					} else {
						// 非http or https开头
						// 本地文件
						let firstStr = el.charAt(0);
						if (firstStr == '/') {
							el = el.substr(1); // 删除第一个字符 '/',因为 configRoot最后一个字符为 /
						}
						el = configRoot + el;
						arrImg.push(el);
					}
				})
				this.img = arrImg;
			} else {
				this.bgColor = prop;
			}
		}
	})
</script>

<style>
	.bg-swiper-box {
		position: absolute;
		display: block;
		width: 100%;
		height: 100%;
	}

	.bg-swiper-img {
		object-fit: cover;
		width: 100%;
		height: 100%;
	}
</style>




  <script>
  function loadMermaid() {
    if (document.getElementsByClassName('mermaid').length) {
      if (window.mermaidJsLoad) mermaid.init()
      else {
        loadScript('https://cdnjs.cloudflare.com/ajax/libs/mermaid/8.6.3/mermaid.min.js').then(() => {
          window.mermaidJsLoad = true
          mermaid.initialize({
            theme: 'default',
          })
          if ('true') {
            mermaid.init();
          }
        })
      }
    }
  };
  document.addEventListener("DOMContentLoaded", function () {
    loadMermaid();
  })

  document.addEventListener('pjax:complete', function () {
    loadMermaid();
  })
  
</script>


      </main>
    </div>

    <!-- 页脚 -->
    
  
  <!-- 底部鱼儿跳动效果，依赖于jquery-->
<div id="j-fish-skip" style=" position: relative;height: 153px;width: auto;"></div>
<script>
  var RENDERER = {
    POINT_INTERVAL: 5,
    FISH_COUNT: 3,
    MAX_INTERVAL_COUNT: 50,
    INIT_HEIGHT_RATE: .5,
    THRESHOLD: 50,
    FISH_COLOR: '',
    init: function () {
      this.setFishColor(); this.setParameters(), this.reconstructMethods(), this.setup(), this.bindEvent(), this.render()
    },
    setFishColor: function () {
      let isDark = JSON.parse(localStorage.getItem('dark')) || JSON.parse('false');
      if (isDark) {
        this.FISH_COLOR = '#222'; // 暗黑色，有时间把这整成一个变量
      } else {
        this.FISH_COLOR = '' || '#42b983';
      }
    },
    setParameters: function () {
      this.$window = $(window), this.$container = $("#j-fish-skip"), this.$canvas = $("<canvas />"), this.context = this.$canvas.appendTo(this.$container).get(0).getContext("2d"), this.points = [], this.fishes = [], this.watchIds = []
    },
    createSurfacePoints: function () {
      var t = Math.round(this.width / this.POINT_INTERVAL);
      this.pointInterval = this.width / (t - 1), this.points.push(new SURFACE_POINT(this, 0));
      for (var i = 1; i < t; i++) {
        var e = new SURFACE_POINT(this, i * this.pointInterval),
          h = this.points[i - 1];
        e.setPreviousPoint(h), h.setNextPoint(e), this.points.push(e)
      }
    },
    reconstructMethods: function () {
      this.watchWindowSize = this.watchWindowSize.bind(this), this.jdugeToStopResize = this.jdugeToStopResize.bind(this), this.startEpicenter = this.startEpicenter.bind(this), this.moveEpicenter = this.moveEpicenter.bind(this), this.reverseVertical = this.reverseVertical.bind(this), this.render = this.render.bind(this)
    },
    setup: function () {
      this.points.length = 0, this.fishes.length = 0, this.watchIds.length = 0, this.intervalCount = this.MAX_INTERVAL_COUNT, this.width = this.$container.width(), this.height = this.$container.height(), this.fishCount = this.FISH_COUNT * this.width / 500 * this.height / 500, this.$canvas.attr({
        width: this.width,
        height: this.height
      }), this.reverse = !1, this.fishes.push(new FISH(this)), this.createSurfacePoints()
    },
    watchWindowSize: function () {
      this.clearTimer(), this.tmpWidth = this.$window.width(), this.tmpHeight = this.$window.height(), this.watchIds.push(setTimeout(this.jdugeToStopResize, this.WATCH_INTERVAL))
    },
    clearTimer: function () {
      for (; this.watchIds.length > 0;) clearTimeout(this.watchIds.pop())
    },
    jdugeToStopResize: function () {
      var t = this.$window.width(),
        i = this.$window.height(),
        e = t == this.tmpWidth && i == this.tmpHeight;
      this.tmpWidth = t, this.tmpHeight = i, e && this.setup()
    },
    bindEvent: function () {
      this.$window.on("resize", this.watchWindowSize), this.$container.on("mouseenter", this.startEpicenter), this.$container.on("mousemove", this.moveEpicenter)
    },
    getAxis: function (t) {
      var i = this.$container.offset();
      return {
        x: t.clientX - i.left + this.$window.scrollLeft(),
        y: t.clientY - i.top + this.$window.scrollTop()
      }
    },
    startEpicenter: function (t) {
      this.axis = this.getAxis(t)
    },
    moveEpicenter: function (t) {
      var i = this.getAxis(t);
      this.axis || (this.axis = i), this.generateEpicenter(i.x, i.y, i.y - this.axis.y), this.axis = i
    },
    generateEpicenter: function (t, i, e) {
      if (!(i < this.height / 2 - this.THRESHOLD || i > this.height / 2 + this.THRESHOLD)) {
        var h = Math.round(t / this.pointInterval);
        h < 0 || h >= this.points.length || this.points[h].interfere(i, e)
      }
    },
    reverseVertical: function () {
      this.reverse = !this.reverse;
      for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].reverseVertical()
    },
    controlStatus: function () {
      for (var t = 0, i = this.points.length; t < i; t++) this.points[t].updateSelf();
      for (t = 0, i = this.points.length; t < i; t++) this.points[t].updateNeighbors();
      this.fishes.length < this.fishCount && 0 == --this.intervalCount && (this.intervalCount = this.MAX_INTERVAL_COUNT, this.fishes.push(new FISH(this)))
    },
    render: function () {
      requestAnimationFrame(this.render), this.controlStatus(), this.context.clearRect(0, 0, this.width, this.height), this.context.fillStyle = this.FISH_COLOR;
      for (var t = 0, i = this.fishes.length; t < i; t++) this.fishes[t].render(this.context);
      this.context.save(), this.context.globalCompositeOperation = "xor", this.context.beginPath(), this.context.moveTo(0, this.reverse ? 0 : this.height);
      for (t = 0, i = this.points.length; t < i; t++) this.points[t].render(this.context);
      this.context.lineTo(this.width, this.reverse ? 0 : this.height), this.context.closePath(), this.context.fill(), this.context.restore()
    }
  },
  SURFACE_POINT = function (t, i) {
    this.renderer = t, this.x = i, this.init()
  };
  SURFACE_POINT.prototype = {
    SPRING_CONSTANT: .03,
    SPRING_FRICTION: .9,
    WAVE_SPREAD: .3,
    ACCELARATION_RATE: .01,
    init: function () {
      this.initHeight = this.renderer.height * this.renderer.INIT_HEIGHT_RATE, this.height = this.initHeight, this.fy = 0, this.force = {
        previous: 0,
        next: 0
      }
    },
    setPreviousPoint: function (t) {
      this.previous = t
    },
    setNextPoint: function (t) {
      this.next = t
    },
    interfere: function (t, i) {
      this.fy = this.renderer.height * this.ACCELARATION_RATE * (this.renderer.height - this.height - t >= 0 ? -1 : 1) * Math.abs(i)
    },
    updateSelf: function () {
      this.fy += this.SPRING_CONSTANT * (this.initHeight - this.height), this.fy *= this.SPRING_FRICTION, this.height += this.fy
    },
    updateNeighbors: function () {
      this.previous && (this.force.previous = this.WAVE_SPREAD * (this.height - this.previous.height)), this.next && (this.force.next = this.WAVE_SPREAD * (this.height - this.next.height))
    },
    render: function (t) {
      this.previous && (this.previous.height += this.force.previous, this.previous.fy += this.force.previous), this.next && (this.next.height += this.force.next, this.next.fy += this.force.next), t.lineTo(this.x, this.renderer.height - this.height)
    }
  };
  var FISH = function (t) {
    this.renderer = t, this.init()
  };
  FISH.prototype = {
    GRAVITY: .4,
    init: function () {
      this.direction = Math.random() < .5, this.x = this.direction ? this.renderer.width + this.renderer.THRESHOLD : -this.renderer.THRESHOLD, this.previousY = this.y, this.vx = this.getRandomValue(4, 10) * (this.direction ? -1 : 1), this.renderer.reverse ? (this.y = this.getRandomValue(1 * this.renderer.height / 10, 4 * this.renderer.height / 10), this.vy = this.getRandomValue(2, 5), this.ay = this.getRandomValue(.05, .2)) : (this.y = this.getRandomValue(6 * this.renderer.height / 10, 9 * this.renderer.height / 10), this.vy = this.getRandomValue(-5, -2), this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1, this.theta = 0, this.phi = 0
    },
    getRandomValue: function (t, i) {
      return t + (i - t) * Math.random()
    },
    reverseVertical: function () {
      this.isOut = !this.isOut, this.ay *= -1
    },
    controlStatus: function (t) {
      this.previousY = this.y, this.x += this.vx, this.y += this.vy, this.vy += this.ay, this.renderer.reverse ? this.y > this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy -= this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(.05, .2)), this.isOut = !1) : this.y < this.renderer.height * this.renderer.INIT_HEIGHT_RATE ? (this.vy += this.GRAVITY, this.isOut = !0) : (this.isOut && (this.ay = this.getRandomValue(-.2, -.05)), this.isOut = !1), this.isOut || (this.theta += Math.PI / 20, this.theta %= 2 * Math.PI, this.phi += Math.PI / 30, this.phi %= 2 * Math.PI), this.renderer.generateEpicenter(this.x + (this.direction ? -1 : 1) * this.renderer.THRESHOLD, this.y, this.y - this.previousY), (this.vx > 0 && this.x > this.renderer.width + this.renderer.THRESHOLD || this.vx < 0 && this.x < -this.renderer.THRESHOLD) && this.init()
    },
    render: function (t) {
      t.save(), t.translate(this.x, this.y), t.rotate(Math.PI + Math.atan2(this.vy, this.vx)), t.scale(1, this.direction ? 1 : -1), t.beginPath(), t.moveTo(-30, 0), t.bezierCurveTo(-20, 15, 15, 10, 40, 0), t.bezierCurveTo(15, -10, -20, -15, -30, 0), t.fill(), t.save(), t.translate(40, 0), t.scale(.9 + .2 * Math.sin(this.theta), 1), t.beginPath(), t.moveTo(0, 0), t.quadraticCurveTo(5, 10, 20, 8), t.quadraticCurveTo(12, 5, 10, 0), t.quadraticCurveTo(12, -5, 20, -8), t.quadraticCurveTo(5, -10, 0, 0), t.fill(), t.restore(), t.save(), t.translate(-3, 0), t.rotate((Math.PI / 3 + Math.PI / 10 * Math.sin(this.phi)) * (this.renderer.reverse ? -1 : 1)), t.beginPath(), this.renderer.reverse ? (t.moveTo(5, 0), t.bezierCurveTo(10, 10, 10, 30, 0, 40), t.bezierCurveTo(-12, 25, -8, 10, 0, 0)) : (t.moveTo(-5, 0), t.bezierCurveTo(-10, -10, -10, -30, 0, -40), t.bezierCurveTo(12, -25, 8, -10, 0, 0)), t.closePath(), t.fill(), t.restore(), t.restore(), this.controlStatus(t)
    }
  }, $(function () {
    RENDERER.init()
    $('.dark').click(function () {
      setTimeout(() => {
        RENDERER.setFishColor();
        RENDERER.context.fill();
      });
    })
  });
</script>
  <div class="footer bg-color">
    <div class="footer-main">
      
        
          <div class="link">
            
              
                <a href="mailto:2985409357@qq.com" class="social">
                  
                    <i class="fa fa-envelope" aria-hidden="true"></i>
                  
                </a>
              
            
              
                <a target="_blank" rel="noopener" href="https://github.com/yangyang-linux" class="social">
                  
                    <i class="fab fa-github" aria-hidden="true"></i>
                  
                </a>
              
            
              
                <a href="tencent://AddContact/?fromId=50&amp;fromSubId=1&amp;subcmd=all&amp;uin=2985409357" class="social">
                  
                    <i class="fab fa-qq" aria-hidden="true"></i>
                  
                </a>
              
            
          </div>
        
      
        
          <div class="footer-copyright">
            <p>Copyright © 2019 - <span id="display_copyright_time"></span> <a target="_blank" rel="noopener" href="https://gitee.com/yangyang-linux">yangyang-linux</a> | Powered by <a target="_blank" rel="noopener" href="https://hexo.io/zh-cn/docs/">Hexo</a> | Theme <a target="_blank" rel="noopener" href="https://github.com/yuang01/theme">Bamboo</a></p>

          </div>
        
      
        
          
            <!-- 不蒜子统计 -->
            <!-- 不蒜子统计 -->
<span id="busuanzi_container_site_pv">
      <i class="fas fa-eye" aria-hidden="true"></i>本站总访问量：<span id="busuanzi_value_site_pv"></span> 次
</span>
<span class="post-meta-divider">|</span>
<span id="busuanzi_container_site_uv" style='display:none'>
      <i class="fas fa-users" aria-hidden="true"></i>本站访客数：<span id="busuanzi_value_site_uv"></span> 人
</span>

          
        
      
        
          <div class="footer-custom">
            
              <div><p><span>本博客已萌萌哒地运行</span><span id="display_live_time"></span></p>
</div>
            
          </div>
        
      
		</br>
		</br>
		</br>
    </div>
  </div>



    <!-- 渲染暗黑按钮 -->
    
      <div class="dark">
  <div class="dark-content">
    <i class="fas fa-moon" aria-hidden="true"></i>
    <!-- <span>关灯</span> -->
  </div>
  
</div>

<script>
  $(function() {
    let isDark = JSON.parse(localStorage.getItem('dark'))  || JSON.parse('false');
    if (isDark) {
      $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-lightbulb" aria-hidden="true"></i>
          </div>
          `
        );
    }
    $('.dark').click(function() {
      if ($(document.body).is('.darkModel')) {
        $(document.body).removeClass('darkModel');
        localStorage.setItem('dark', false);
        $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-moon" aria-hidden="true"></i>
          </div>
          `
        );
      } else {
        $(document.body).addClass('darkModel');
        localStorage.setItem('dark', true);
        $(".dark-content").replaceWith(
          `
          <div class='dark-content'>
            <i class="fas fa-lightbulb" aria-hidden="true"></i>
          </div>
          `
        );
      }
    })
  })
</script>
    
    <!-- 渲染回到顶部按钮 -->
    
      <div class="goTop top-btn-color" pointer>
  <i class="fas fa-arrow-up" aria-hidden="true"></i>
</div>
<script src="/js/goTop.js"></script>

    
    <!-- 渲染左下角音乐播放器 -->
    
      <link rel="stylesheet" href="/js/aplayer/APlayer@1.10.1.min.css">
<style>
.aplayer .aplayer-lrc p {
  
  font-size: 12px;
  font-weight: 700;
  line-height: 16px !important;
}

.aplayer .aplayer-lrc p.aplayer-lrc-current {
  
  font-size: 15px;
  color: #C90041;
}


.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body {
  left: -66px !important;
}

.aplayer.aplayer-fixed.aplayer-narrow .aplayer-body:hover {
  left: 0px !important;
}


</style>
<meting-js  
  class=""
  server="netease"
  type="playlist"
  id="5300120281"
  fixed='true'
  autoplay='true'
  theme='#C90041'
  loop='all'
  order='random'
  preload='auto'
  volume='0.4'
  list-folded='true'
>
</meting-js>

<!-- <style>
  #aplayer {
    position: fixed;
    left: 0;
    bottom: 300px;
  }
</style> -->
<script src="https://unpkg.com/aplayer@1.10.1/dist/APlayer.min.js"></script>
<script src="https://unpkg.com/meting@2/dist/Meting.min.js"></script>
    

    <!-- 图片放大 -->
    
      <script src="/js/fancybox/jquery.fancybox.min.js"></script>
    

    <!-- 百度解析 -->
    <!-- Baidu Analytics -->

    <!-- Baidu Push -->

<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        } else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>

    
    <!-- 背景彩带 -->
    
      <script type="text/javascript" size="100" alpha='0.4' zIndex="-1" src="/js/ribbon.min.js"></script>
    

    <script src="/js/utils/index.js"></script>
    <script src="/js/app.js"></script>
    
    <!-- 文章目录所需js -->
<link href="/js/tocbot/tocbot.css" rel="stylesheet">
<script src="/js/tocbot/tocbot.min.js"></script>

<script>
  var headerEl = 'h1, h2, h3, h4, h5, h6',  //headers 
    content = '.post-detail',//文章容器
    idArr = {};  //标题数组以确定是否增加索引id
  //add #id
  var option = {
    // Where to render the table of contents.
    tocSelector: '.toc',
    // Where to grab the headings to build the table of contents.
    contentSelector: content,
    // Which headings to grab inside of the contentSelector element.
    headingSelector: headerEl,
    scrollSmooth: true,
    scrollSmoothOffset: -80,
    headingsOffset: -($(window).height() * 0.4 - 45),
    positionFixedSelector: '.toc-main',
    positionFixedClass: 'is-position-fixed',
    fixedSidebarOffset: 'auto',
    activeLinkClass: 'is-active-link',
    // onClick: function (e) {},
  }
  if ($('.toc').length > 0) {

    $(content).children(headerEl).each(function () {
      //去除空格以及多余标点
      var headerId = $(this).text().replace(/[\s|\~|`|\!|\@|\#|\$|\%|\^|\&|\*|\(|\)|\_|\+|\=|\||\|\[|\]|\{|\}|\;|\:|\"|\'|\,|\<|\.|\>|\/|\?|\：|\，|\。]/g, '');

      headerId = headerId.toLowerCase();
      if (idArr[headerId]) {
        //id已经存在
        $(this).attr('id', headerId + '-' + idArr[headerId]);
        idArr[headerId]++;
      }
      else {
        //id未存在
        idArr[headerId] = 1;
        $(this).attr('id', headerId);
      }
    });

    document.addEventListener("DOMContentLoaded", function () {
      tocbot.init(option);
      mobileTocClick();
    });

  }

  window.tocScrollFn = function () {
    return bamboo.throttle(function () {
      findHeadPosition();
    }, 100)()
  }
  window.addEventListener('scroll', tocScrollFn);

  const findHeadPosition = function (top) {
    if ($('.toc-list').length <= 0) {
      return false;
    }
    setTimeout(() => {  // or DOMContentLoaded 
      autoScrollToc();
    }, 0);
  }

  const autoScrollToc = function () {
    const $activeItem = document.querySelector('.is-active-link');
    const $cardToc = document.querySelector('.toc-content');
    const activePosition = $activeItem.getBoundingClientRect().top
    const sidebarScrollTop = $cardToc.scrollTop
    if (activePosition > (document.documentElement.clientHeight - 100)) {
      $cardToc.scrollTop = sidebarScrollTop + 150
    }
    if (activePosition < 100) {
      $cardToc.scrollTop = sidebarScrollTop - 150
    }
  }

  document.addEventListener('pjax:send', function () {
    if ($('.toc').length) {
      tocbot.destroy();
    }
  });

  document.addEventListener('pjax:complete', function () {
    if ($('.toc').length) {
      tocbot.init(option);
      mobileTocClick();
    }
  });
  
  // 手机端toc按钮点击出现目录
  const mobileTocClick = function () {
    const $cardTocLayout = document.getElementsByClassName('toc-aside')[0];
    const $cardToc = $cardTocLayout.getElementsByClassName('toc-content')[0];
    let right = '45px';
    if (window.innerWidth >= 551 && window.innerWidth <= 992) {
      right = '100px'
    }
    const mobileToc = {
      open: () => {
        $cardTocLayout.style.cssText = 'animation: toc-open .3s; opacity: 1; right: ' + right
      },

      close: () => {
        $cardTocLayout.style.animation = 'toc-close .2s'
        setTimeout(() => {
          $cardTocLayout.style.cssText = "opacity:''; animation: ''; right: ''"
        }, 100)
      }
    }
    document.getElementById('toc-mobile-btn').addEventListener('click', () => {
      if (window.getComputedStyle($cardTocLayout).getPropertyValue('opacity') === '0') mobileToc.open()
      else mobileToc.close()
    })

    $cardToc.addEventListener('click', (e) => {
      if (window.innerWidth < 992) { // 小于992px的时候
        mobileToc.close()
      }
    })
  }
</script>

<style>
  .is-position-fixed {
    position: sticky !important;
    top: 74px;
  }

  .toc-main ul {
    counter-reset: show-list;
  }

  .toc-main ul li::before {
    content: counter(item)".";
    display: block;
    position: absolute;
    left: 12px;
    top: 0;
  }
</style> 

<!-- 设置导航背景 -->
<script>
  let setHeaderClass = () => {
    const headerMenuTransparent = true;
    if (!headerMenuTransparent) { return; }
    const nav = $('#navHeader');
    const navTop = nav.outerHeight();
    const winTop = $(window).scrollTop();
    if(winTop > navTop) {
      nav.addClass('header-bg-color');
    }
    else {
      nav.removeClass('header-bg-color');
    }
  };

  let scrollCollect = () => {
    return bamboo.throttle(function (e) {
      setHeaderClass();
    }, 200)()
  }

  let initHeaderBg = () => {
    setHeaderClass();
  }

  setHeaderClass();
  window.addEventListener('scroll', scrollCollect);

  document.addEventListener('pjax:send', function () {
    window.removeEventListener('scroll', scrollCollect)
  })
  document.addEventListener('pjax:complete', function () {
    window.addEventListener('scroll', scrollCollect);
    setHeaderClass();
  })
</script> 

<!-- 渲染issues标签里的内容 -->
<script>
  function loadIssuesJS() {
    if ($(".post-detail").find(".issues-api").length == 0) {
      return;
    } 
    loadScript('/js/issues/index.js');
  };
  $(function () {
    loadIssuesJS();
  });
  document.addEventListener('pjax:complete', function () {
    if (typeof IssuesAPI == "undefined") {
      loadIssuesJS();
    }
  })
</script>

<!-- 输入框打字特效 -->
<!-- 输入框打字特效 -->

  <script src="/js/activate-power-mode.js"></script>
  <script>
    POWERMODE.colorful = true;  // 打开随机颜色特效
    POWERMODE.shake = false;    // 关闭输入框抖动
    document.body.addEventListener('input', POWERMODE);//监听打字事件
  </script>


<!-- markdown代码一键复制功能 -->

  <link rel="stylesheet" href="https://unpkg.com/v-plugs-ayu/lib/ayu.css">
  <script src="https://unpkg.com/v-plugs-ayu/lib/ayu.umd.min.js"></script>
  <script src="/js/clipboard/clipboard.min.js"></script>
  <div id="appCopy">
  </div>
  <script data-pjax>
    var vm = new Vue({
      el: '#appCopy',
      data: {
      },
      computed: {
      },
      mounted() {
        const that = this;
        var copy = '复制';
        /* code */
        var initCopyCode = function () {
          var copyHtml = '';
          copyHtml += '<button class="btn-copy" data-clipboard-snippet="" style="position:absolute;top:0;right:0;z-index:1;">';
          copyHtml += '<i class="fas fa-copy"></i><span>' + copy + '</span>';
          copyHtml += '</button>';
          $(".post-detail pre").not('.gutter pre').wrap("<div class='codeBox' style='position:relative;width:100%;'></div>")
          $(".post-detail pre").not('.gutter pre').before(copyHtml);
          new ClipboardJS('.btn-copy', {
            target: function (trigger) {
              return trigger.nextElementSibling;
            }
          });
        }
        initCopyCode();
        $('.btn-copy').unbind('click').bind('click', function () {
          doSomething();
        })
        $(document).unbind('keypress').bind('keypress', function (e) {
          if (e.ctrlKey && e.keyCode == 67) {
            doSomething();
          }
        })

        function doSomething() {
          that.$notify({
            title: "成功",
            content: "代码已复制，请遵守相关授权协议。",
            type: 'success'
          })
        }
      },
      methods: {
      },
      created() { }
    })
  </script>
  

<!-- 图片懒加载 -->
<script defer src="https://unpkg.com/vanilla-lazyload@17.1.0/dist/lazyload.min.js"></script>
<script>
  // https://www.npmjs.com/package/vanilla-lazyload
  // Set the options globally
  // to make LazyLoad self-initialize
  window.lazyLoadOptions = {
    elements_selector: ".lazyload",
    threshold: 0
  };
  // Listen to the initialization event
  // and get the instance of LazyLoad
  window.addEventListener(
    "LazyLoad::Initialized",
    function (event) {
      window.lazyLoadInstance = event.detail.instance;
    },
    false
  );
  document.addEventListener('DOMContentLoaded', function () {
    lazyLoadInstance.update();
  });
  document.addEventListener('pjax:complete', function () {
    lazyLoadInstance.update();
  });
</script>


<!-- 卡片滚动动画 -->

    <script type="text/javascript">
  loadScript("https://unpkg.com/scrollreveal@4.0.6/dist/scrollreveal.min.js")
  function pjax_scrollrebeal() {
    ScrollReveal().reveal('.reveal', {
      distance: '120px',
      duration: '400',
      interval: '30',
      scale: '1',
      origin: 'bottom', // 动画开始的方向
      easing: 'ease'
    });
  }
  $(function () {
    var checkScrollReveal = setInterval(function () {
      if ($("#safearea").css("display") != "block") return
      if (typeof ScrollReveal == "undefined") return
      clearInterval(checkScrollReveal)
      pjax_scrollrebeal();
    }, 100)
  });
  document.addEventListener('pjax:complete', function () {
    pjax_scrollrebeal();
  })
</script>
   

<!-- 评论所需js -->

  
    <!-- 弹幕所需的css和js -->
    
  <!-- 弹幕插件 -->
  <link href="/js/danmu/barrager.css" rel="stylesheet">
  <script src="/js/danmu/jquery.barrager.js"></script>

<!-- 具体js，请前往valine/script.ejs查看 -->

    <script>
  var requiredFields = 'nick';
  requiredFields = requiredFields.split(',');
  comment_el = '.comment';
  let looperValine = null;
  load_valine = function () {
    if ($(comment_el).length) {
      var valine = new Valine({
        el: '#vcomment',
        path: window.location.pathname,
        notify: false,
        verify: false,
        app_id: "HvvYcruryPsiW2egxIpRnlKV-gzGzoHsz",
        app_key: "MLKN1tH2RNDMR4e3O9PJgAh5",
        placeholder: "客官，说点什么吧（如果想让我及时收到的话可以连续发送两遍，会触发邮件提醒机制）",
        avatar: "wavatar",
        master: "3d28ff93d17df2e86f7971eda5159791",   //博主邮箱md5
        tagMeta: ["博主","小伙伴","访客"],     //标识字段名
        friends: "8b42635701290c05327f3faba356ce6e",
        metaPlaceholder: { "nick": "昵称/QQ号", "mail": "邮箱" },
        requiredFields: requiredFields,
        enableQQ: true,
      });
      function debounce(fn) {
        var timerID = null
        return function () {
          var arg = arguments[0]   //获取事件
          if (timerID) {
            clearTimeout(timerID)
          }
          timerID = setTimeout(function () {
            fn(arg)              //事件传入函数
          }, 200)
        }
      }
      //查询评论 valine.Q('*').limit(7) -- 查询所有，限制7条, 下面的的代码是查询当前页面
      var themeDanmu = eval('true');
      var themeLoop = eval('false');
      var themeLooperTime = '5000' || 5000;
      var speed = '20' || 20;
      var isBarrager = true;
      if (themeDanmu == true) {
        do_barrager();
        if ($('.danmuBox').length <= 0) {
          $('.navbar').append('<div class="danmuBox"><div class="danmuBtn open"><span class="danmuCircle"></span><span class="danmuText">弹幕</span></div></div>');
        }
        $('.danmuBtn').on('click', debounce(
          function () {
            if ($('.danmuBtn').hasClass('open')) {
              $('.danmuBtn').removeClass('open')
              clearInterval(looperValine);
              $.fn.barrager.removeAll();
            } else {
              $('.danmuBtn').addClass("open");
              do_barrager();
            }
          }
        ))
      }
      function do_barrager() {
        isBarrager && valine.Q(window.location.pathname).find().then(function (comments) {
          // var num = 0; // 可以记录条数，循环调用的时候只取最新的评论放入弹幕中
          var run_once = true;
          var looper_time = themeLooperTime;
          var total = comments.length;
          // var looper = null;
          var index = 0;
          if (total > 0) {
            barrager();
          } else {
            // 当评论数为0的时候，自动关闭弹幕
            // $('.danmuBtn').removeClass('open');
          }
          function barrager() {
            if (run_once) {
              //如果是首次执行,则设置一个定时器,并且把首次执行置为false
              looperValine = setInterval(barrager, looper_time);
              run_once = false;
            }
            var content = comments[index]._serverData.comment;
            var email = comments[index]._serverData.mail;
            var link = comments[index]._serverData.link;
            var newcontent = content.substring(0, 50).replace(/<[^>]+>/g, "");
            //发布一个弹幕
            const item = {
              img: `https://q1.qlogo.cn/g?b=qq&nk=${email}&s=640`, //图片 
              info: newcontent, //文字 
              href: link, //链接 
              close: true, //显示关闭按钮 
              speed: speed, //延迟,单位秒,默认6 
              color: '#fff', //颜色,默认白色 
              old_ie_color: '#000000', //ie低版兼容色,不能与网页背景相同,默认黑色
            }
            $('body').barrager(item);
            //索引自增
            index++;
            //所有弹幕发布完毕，清除计时器。
            if (index == total) {
              clearInterval(looperValine);
              if (themeLoop === true) {
                setTimeout(function () {
                  do_barrager();
                }, 5000);
              } else {
                $('.danmuBtn').removeClass('open');
              }
              return false;
            }

          }
        })
      }
    }
  };
  $(document).ready(load_valine);
  document.addEventListener('pjax:send', function (e) {
    
      $('.danmuBox').length > 0 && $('.danmuBox').remove()
      looperValine && clearInterval(looperValine);
      $.fn.barrager.removeAll();
    
  })
  document.addEventListener('pjax:complete', function () {
    load_valine();
  });
</script>

  


<!-- 鼠标点击特效 -->
<!-- 爱心点击 -->

  
    <script src="/js/cursor/fireworks.js"></script>
  




  <script async src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js" data-pjax></script>


    <!-- pjax -->
    

<!-- pjax -->


  <script src="/js/pjax@0.2.8/index.js"></script>
  
    <!-- 样式位于：source/css/_third-party/pjaxanimate.styl -->

<div class="pjax-animate">
  
    <div class="loading-circle"><div id="loader-circle"></div></div>
    <script>
      window.ShowLoading = function() {
        $(".loading-circle").css("display", "block");
      };
      window.HideLoading = function() {
        $(".loading-circle").css("display", "none");
      }
    </script>
  
	<script>
    document.addEventListener('pjax:complete', function () {
      window.HideLoading();
    })
    document.addEventListener('pjax:send', function () {
      window.ShowLoading();
    })
    document.addEventListener('pjax:error', function () {
      window.HideLoading();
    })
	</script>
</div>

  

  <script>
    var pjax = new Pjax({
      elements: 'a[href]:not([href^="#"]):not([href="javascript:void(0)"]):not([no-pjax])',   // 拦截正常带链接的 a 标签
      selectors: ["#pjax-container","title"],                                   // 根据实际需要确认重载区域
      cacheBust: false,   // url 地址追加时间戳，用以避免浏览器缓存
      timeout: 5000
    });

    document.addEventListener('pjax:send', function (e) {

      try {
        var currentUrl = window.location.pathname;
        var targetUrl = e.triggerElement.href;
        var banUrl = [""];
        if (banUrl[0] != "") {
          banUrl.forEach(item => {
            if(currentUrl.indexOf(item) != -1 || targetUrl.indexOf(item) != -1) {
              window.location.href = targetUrl;
            }
          });
        }
      } catch (error) {}

      $(window).unbind('resize');
      $(window).unbind('scroll');
      $(document).unbind('scroll');
      $(document).unbind('click');
      $('body').unbind('click');

    })
    
    document.addEventListener('pjax:complete', function () {
      $('script[data-pjax], .pjax-reload script').each(function () {
        $(this).parent().append($(this).remove());
      });
    });

    document.addEventListener('pjax:error', function (e) {
      window.location.href = e.triggerElement.href;
    })
    
    // 刷新不从顶部开始
    document.addEventListener("DOMContentLoaded", function () {
      history.scrollRestoration = 'auto';
    })
  </script>



  </body>
</html>